<template>
  <div id="centerLeft1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-line" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2" style="font-size: 15px">班级学生去留情况</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board class="dv-scr-board" :config="config" />
      </div>
    </div>
  </div>
</template>

<script>
import {getClass} from "@/axios/api";

export default {
  data() {
    return {
      config: {}
    }
  }, mounted() {
    this.getClass()
  }, methods: {
    async getClass() {
      var data = []
      let clas = await getClass().then(res => res.data)
      if (clas.length > 0){
        for (var i = 0; i < clas.length; i++) {
          data[i] = ([clas[i][0], clas[i][1],clas[i][2],"<span  class='colorBlue'>" + clas[i][3] + "</span>", "<span  class='colorRed'>" + clas[i][4] + "</span>"])
        }
        this.config = {
          header: ['班级', '班主任', '人数', '请假', '销假'],
          data: data,
          rowNum: 7, //表格行数
          headerHeight: 35,
          headerBGC: '#0f1325', //表头
          oddRowBGC: '#0f1325', //奇数行
          evenRowBGC: '#171c33', //偶数行
          index: true,
          columnWidth: [50],
          align: ['left']
        }
      }else if (clas === null) {
        alert("系统错误")
      }
    }
  }
}
</script>

<style lang="scss" scoped>
$box-height: 410px;
$box-width: 620px;
#centerLeft1 {
  padding: 20px;
  padding-top: 20px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-scr-board {
      width: 590px;
      height: 350px;
    }
  }
}
</style>
